#pragma once
#include <lcir/IR/Lambda.h>
namespace lcir {
class Pass {
  Lambda *lambda{nullptr};

 public:
  Pass() = default;
  Pass(Lambda *l) : lambda(l) {}
  Lambda *getLambda() { return lambda; }
  void setLambda(Lambda *l) { lambda = l; }
  virtual void run() = 0;
  virtual ~Pass() {}
};
template <class DerivedTy>
class PassCRTP : public Pass {
 public:
  static std::unique_ptr<DerivedTy> create(Lambda *lambda) {
    auto pass = std::make_unique<DerivedTy>();
    pass->setLambda(lambda);
    return pass;
  }
};

}  // namespace lcir